Test FAMS on 1D data

Contents

randomize data

max_uniform=100;
vect1 = rand(100,1)*max_uniform; % uniform
vect2 = randn(100,1)*1+20; %first gauss
vect3 = randn(100,1)*1+60; %second gauss
data=[vect1;  vect2; vect3];

run FAMS

[modes,p_modes,w_modes ] =fams(data,20,5,50,'exmpl1D','res/');
Load data points from matlab ...done
RunFAMS with res/pilot_50_exmpl1D.txt ...
Running FAMS with K=20 L=5
 Run pilot adaptive...load bandwidths...done.
 Start MS iterations..........done.
 Join Modes with adaptive h/2, min pt=40, jump=1
            pass 1done
            pass 2..........nrel 4
0 0
1 1
2 2
3 3
done
Save convergence points   ...done
Save joined convergence points ...done
Save indicies of modes  ...done
FAMS done.

view results

p_modes
figure(1),clf;
subplot(2,2,1),plot(data,'*'),title('1D data (x:sample num, y:value)');
subplot(2,2,2),plot(modes,'*'),title('after fams');
[f,xi]=ksdensity(modes,'width',2);
subplot(2,2,3),plot(xi,f,'.g');
subplot(2,2,4),hist(modes,10);
p_modes =
   83.0000   20.3087
   59.0000   59.3386
   46.0000   59.9733
   43.0000   18.3730